package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;


public class OrderCTR
{
   private ProductCTR productCTR;
   private CustomerCTR customerCTR;
   private StaffCTR staffCTR;
   private OrderContainer orderContainer;
   private OrderContainer cctr;
   public OrderCTR()
    {
       productCTR = new ProductCTR();
       customerCTR = new CustomerCTR();
       staffCTR = new StaffCTR();
       orderContainer = orderContainer.getInstance();
    }
    public void createOrder(int productID, int serial, int orderID, String phone, String seller)
    { 
      Customer customer;
      customer = customerCTR.getCustomer(phone);
      Specimen specimen;
      specimen = productCTR.getSpecimen(productID, serial);
      Staff staff;
      staff = staffCTR.getStaff(seller);
      orderContainer.createOrder(customer,  specimen, staff, orderID);
    }
    public Product findProduct(int id)
    {
        return productCTR.findProduct(id);
    }
     public ArrayList<Order> findAllOrders(String phone)
   {
       return orderContainer.findAllOrders(phone);
   }
   public Order getOrder(String phoneNo)
   {
       Order order = cctr.findOrder(phoneNo);
       return order;
   }
    
}
